<template>
  <div v-loading.lock="fullscreenLoading" class="Report">
    <iframe ref="frameReport" name="frameReport" :src="src" class="frame-report" scrolling="yes" @load="load" />
  </div>
</template>
<style lang="scss">
  @import "./_Report.scss";
</style>
<script>
export default {
  props: {
    url: {
      type: String,
      default: 'about:blank'
    }
  },
  data() {
    return {
      src: this.url,
      // 遮罩
      fullscreenLoading: false
    }
  },
  watch: {
    url(newValue) {
      if (newValue !== 'about:blank' || newValue !== '') {
        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
        this.fullscreenLoading = true
        this.src = newValue
      }
    }
  },
  methods: {
    load() {
      this.fullscreenLoading = false
      this.$emit('load')
    }
  }
}
</script>
